package com.zh.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description: es 配置类
 * @ClassName ElasticSearchConfig
 * @date: 2021.05.06 15:52
 * @Author: zhanghang
 */
@Configuration
public class ElasticSearchConfig {
    
    /**
     * description: 高级客户端 
     * date: 2021年-05月-06日 16:15
     * author: zhanghang
     * 
     * @param 
     * @return org.elasticsearch.client.RestHighLevelClient
     */ 
    @Bean
    public RestHighLevelClient restHighLevelClient(){
        RestHighLevelClient restHighLevelClient = new RestHighLevelClient(
                RestClient.builder(
                       new HttpHost("localhost",9200,"http")
                ));
        return restHighLevelClient;
    }
}
